package org.studio.crusoe.framework.aop.intercept;

import java.lang.reflect.Method;

import org.studio.crusoe.framework.aop.invokecontrol.MethodInvocation;

public class MethodTestAdvice implements IMethodAdvice, IMethodBeforeAdvice, IMethodAfterAdvice,
        IThrowsAdvice {

    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("method invoke advice");
        //throw new Exception();
        return invocation.invoke();
    }

    public void before(Method method, Object[] args, Object obj) throws Throwable {
        System.out.println("before advice");
    }

    public void after(Object returnObj, Method method, Object[] args, Object obj) throws Throwable {
        System.out.println("after advice:" + returnObj);
    }

    public void afterThrows(Throwable throwable) {
        System.out.println("exception advice");
    }

}
